package com.sheyu.mall.product.service;

import com.sheyu.mall.product.dao.category.CategoryBrandRelationDao;
import com.sheyu.mall.product.entity.category.CategoryBrandRelationEntity;
import com.sheyu.mall.product.service.category.CategoryBrandRelationService;
import net.bytebuddy.asm.Advice;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

/**
 * @author sheyu
 * @Desciption:
 * @date 2020/10/10 8:08 上午
 */

@RunWith(SpringRunner.class)
@SpringBootTest
public class CategoryBrand {

    @Autowired
    private CategoryBrandRelationDao categoryBrandRelationDao;

    @Autowired
    private CategoryBrandRelationService categoryBrandRelationService;

    @Test
    public void testSelectByCatelogId(){
        List<Long> catelogIds = new ArrayList<>();
        catelogIds.add(225L);
        catelogIds.add(1L);
        Long brandIds  = categoryBrandRelationDao.selectByCatIdBySQL(catelogIds.get(0));
        System.out.println(brandIds);
    }

    @Test
    public void testGetResultByBradId(){
        List<CategoryBrandRelationEntity> categoryBrandRelationEntities = categoryBrandRelationDao.selectListBySQL(1L);
        System.out.println(categoryBrandRelationEntities);
    }

    @Test
    public void testSelectByBrandId(){
        long l = categoryBrandRelationDao.selectByBrandId(45L);
        System.out.println(l);
    }

    @Test
    public void testUpdateBrand(){
     categoryBrandRelationService.updateBrand(1L,"小米10");
    }
}
